[Autorun] New plugin#1582
Conversation
add globals def
Update README to account for non-stdin tools
add _free for autorun defined types
wire up _free for autorun defined types
add spawn controller impl
Remove my mktemp impl as gtk has one Flesh out the spawn.c handler Ensure %f %d and %p are honored in spawn Prevent spawn from actually editing before-save until testing completed document-save is handled entirely externally and is live ***THIS WILL ALTER YOUR FILESYSTEM IF YOU ADD A HANDLER*** Updates geany#1577
Update all documents with .clang-format backed formatting changes
Clarified README to point to Status and Compiler instead of Terminal reordered all includes to make them uniform
ensure translation setup was done fixed tempfile writes for %a tools added CMakeLists.txt as a template for clang-tidy runs
WrapEarnPass
left a comment
There was a problem hiding this comment.
It is missing a menu system, but that was a nice to have anyway.
It is still a <1.0 release because I want at least a few other people to test it for use cases I can't reproduce before it is 1.0.
I am using it daily now, so there is a chance I will find errors for the use case of "on linux"
I could probably make the stdout/stderr handler smarter to allow for formatting arbitrary messages, but that wasn't really in scope for the request.
Fixed a parsing issue with empty string commands Had to turn project-save back on in order to store Project gkeyfile changes
|
There wasn't any interim actions here, so I rolled the Menu changes into this Pull as well. |
|
Maybe you could explain what this new plugin does in the OP, so we know what we're looking at? |
I am not sure what OP means in this context. |
|
Moved this from the initial comment so I could add "about this plugin" to the initial comment. I know this project doesnt use clang-tidy, but I happen to use it, so I set it up too. That looks like clang-tidy doesn't get the po/ loader magic, but nothing else reported. built against geany/geany@98bcbee |
|
There's not been any changes here, and I made the output more intelligent. Now it checks to see if any output contains an open filename and colors it red so Compiler can use it's internal logic to build clicky-mapping. Pushing those changes into this Pull. |
try to use Compilers built in clicky-jump instead of creating a new parser Update README to note the change in the output location
Fix uniform AUTORUN_ namespaces Updated README to reflect async changes Fix progressbar handler actually works now
|
I got clangd setup on my geany 2.1 system install, and recompiled this for 2.1.
Pushing that fix. In other news, this code works in geany/2.1, which leads to a question. Is 2.1 closed? Can I submit this to 2.1 as well? |
housekeeping comments to ensure they are uniformly formatted change macro gluing tooltips to strings to fix code formatting
|
With a sufficiently malicious filename, spawn cannot be trusted. Directory comes from Geany runtime environment, and other arguments from user preferences, but the filename could be an attack vector in an "automatic run" environment. As noted in https://docs.gtk.org/glib/func.shell_quote.html this is a best effort. |
g_shell_quote is not portable This reverts commit 06103a4.
update README with notes about filenames this commit is expected long term approach for geany#1584 for Auto-run
fix used a uint instead of a guint



What this plugin does:
intercept the Geany signals in an extensible way (more handlers can be added later with minimal refactoring).
The handlers that are implemented in this release:
document-before-save
document-save
When the plugin loads it looks for filetypes.EXT like build does. If it finds any [autorun] sections, it loads the matching keys as commands to be executed during one of the handlers.
If there is a Project open, it looks for [autorun] in the Project .geany, and overrides any filetypes.EXT handlers.
When a instrumented handler fires, it processes the list of commands that have been loaded for that signal.
My specific use case is I have no code formatting conformity when I am writing. I rely heavily on clang-format. I need it to run on-save, on every save or my code looks like crep.
I also like for tidy to remind me if my code has any known issues as I write it, so I don't have to go back from build to fix a bunch of stuff at once.
I configured a filetypes.c to attach clang-format to document-before-save, and clang-tidy to document-save.
I also use cmake, but cmake-format doesnt do stdin, so I implemented a dump of scintilla to tmpfile so I could run cmake-format on document-before-save.
If the commands at document-before-save succeeds, scintilla is overwritten by either the contents of the tmpfile (if changed) or the results of stdout. stderr goes to Compiler.
If the commands at document-save succeeds, that is done at the file level, so I just report the stdout and stderr to Compiler.
Overall success/failure/could not run command is attached as a Status.
I try to be nice about attaching 'jump to scintilla' for messages, but am ultimately dependent on Compiler for that.
The UI for Auto-run, as submitted, only allows setting 1 before-save and 1 on-save command per filetype in the Project properties. Editing the filetypes.EXT or .geany manually, you can attach up to 100 total commands.
I use this to allow me to run on-save for both clang-tidy as I prefer, and cppcheck as Geany prefers on code I am submitting to Geany.
I used a very similar command format to Geany>Project>Build which supports inline replacements
Examples:
filetypes.c
projectfile.geany
I couldn't come up with a use case for before-save/on-save for None files, so this doesn't support actions on None files.